﻿using Corina.Datamodel.Base;
using Corina.Datamodel.Interface;
using Corina.Enumerations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Runtime.Serialization;

namespace Corina.Datamodel.Entities
{
    [XmlTypeAttribute(Namespace = "http://tempuri.org/")]
    [DataContract]
    public class OverproofNotificationInfo : DatamodelEntity, IOverproofNotification
    {
        #region Fields
        private int _id;
        private int _userId = 0;
        private string _deviceSn;
        private string _measureObject;
        private double _density = 0;
        private DateTime _time = DateTime.Now;
        private bool _read = false;
        #endregion

        #region Properties
        [DataMember]
        public int Id
        {
            get { return _id; }
            set
            {
                _id = value;
                RaisePropertyChanged(() => Id);
            }
        }

        [DataMember]
        public int UserId
        {
            get { return _userId; }
            set
            {
                _userId = value;
                RaisePropertyChanged(() => UserId);
            }
        }

        [DataMember]
        public string DeviceSn
        {
            get { return _deviceSn; }
            set
            {
                _deviceSn = value;
                RaisePropertyChanged(() => DeviceSn);
            }
        }

        [DataMember]
        public string MeasureObject
        {
            get { return _measureObject; }
            set
            {
                _measureObject = value;
                RaisePropertyChanged(() => MeasureObject);
            }
        }

        [DataMember]
        public double Density
        {
            get { return _density; }
            set
            {
                _density = value;
                RaisePropertyChanged(() => Density);
            }
        }

        [DataMember]
        public DateTime Time
        {
            get { return _time; }
            set
            {
                _time = value;
                RaisePropertyChanged(() => Time);
            }
        }

        [DataMember]
        public bool Read
        {
            get { return _read; }
            set
            {
                _read = value;
                RaisePropertyChanged(() => Read);
            }
        }

        #endregion

        protected override IEnumerable<DatabaseColumn> InitColumns()
        {
            yield return new DatabaseColumn("Id", true);
            yield return new DatabaseColumn("UserId");
            yield return new DatabaseColumn("DeviceSn");
            yield return new DatabaseColumn("MeasureObject");
            yield return new DatabaseColumn("Density");
            yield return new DatabaseColumn("Time");
            yield return new DatabaseColumn("Read");
        }
    }
}